package org.lili.methodchain;

import org.lili.semanticmodel.Graph;

/**
 * @author lili
 * @description GraphBuilder which is the expression builder for populating the Graph model.
 * @create 2018-04-22 下午3:34
 * @since
 **/
public class GraphBuilder {

    private Graph graph;

    public GraphBuilder() {
        graph = new Graph();
    }

    /**
     * expression builder:build the complete Graph
     * Start the Graph DSL with this method.
     * @return
     */
    public static GraphBuilder Graph() {
        return new GraphBuilder();
    }

    /**
     * expression builder:build individual edges
     * Start the edge building with this method.
     * @return
     */
    public EdgeBuilder edge() {
        EdgeBuilder builder = new EdgeBuilder(this);
        getGraph().addEdge(builder.edge);
        return builder;
    }

    public void printGraph() {
        Graph.printGraph(graph);
    }

    public Graph getGraph() {
        return graph;
    }
}
